<template>
    <div class="app-container">
      <el-form
        :model="queryParams"
        ref="queryForm"
        size="small"
        :inline="true"
        v-show="showSearch"
      >
        <el-form-item label="窗口编号" prop="windowNo">
          <el-input
            v-model="queryParams.windowNo"
            placeholder="请输入窗口编号"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item>
          <el-button
            type="primary"
            icon="el-icon-search"
            size="mini"
            @click="handleQuery"
            >搜索</el-button
          >
          <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
            >重置</el-button
          >
        </el-form-item>
      </el-form>
      <el-row :gutter="10" class="mb8">
        <el-col :span="1.5">
          <el-button
            type="primary"
            plain
            icon="el-icon-plus"
            size="mini"
            @click="handleAdd"
            v-hasPermi="['business:windowUser:add']"
            >新增</el-button
          >
        </el-col>
        
        <right-toolbar
          :showSearch.sync="showSearch"
          @queryTable="getList"
        ></right-toolbar>
      </el-row>
  
      <el-table
        @selection-change="handleSelectionChange"
        fit
        v-loading="loading"
        border
        :data="dataList"
      >
        <el-table-column type="selection" width="55" align="center" />
        <el-table-column label="序号" type="index" />
        <el-table-column
          label="窗口编号"
          prop="windowNo"
          :show-overflow-tooltip="true"
        >
        </el-table-column>
        <el-table-column
          label="人员"
          prop="userName"
          :show-overflow-tooltip="true"
        >
        </el-table-column>
        <el-table-column
          :show-overflow-tooltip="true"
          label="图片"
          prop="content"
        >
          <template slot-scope="scope">
         
           <div style="width: 200px;" >
            <el-image
              :src="baseUrl+scope.row.photoUrl"
              fit="contain"
              width="100px"
              height="100px"
            />
           </div>
          </template>
        </el-table-column>
        <el-table-column
          label="操作"
          align="center"
          class-name="small-padding fixed-width"
          width="200"
          fixed="right"
        >
          <template slot-scope="scope">
            <el-button
              size="mini"
              type="text"
              icon="el-icon-view"
              v-hasPermi="['business:windowUser:info']"
              @click="handleDetail(scope.row)"
              >详情</el-button
            >
            <el-button
              size="mini"
              type="text"
              icon="el-icon-edit"
              @click="handleUpdate(scope.row)"
              v-hasPermi="['business:windowUser:edit']"
              >修改</el-button
            >
            <el-button
              size="mini"
              type="text"
              icon="el-icon-delete"
              @click="handleDelete(scope.row)"
              v-hasPermi="['business:windowUser:remove']"
              >删除</el-button
            >
          </template>
        </el-table-column>
      </el-table>
  
      <pagination
        v-show="total > 0"
        :total="total"
        :page.sync="queryParams.pageNum"
        :limit.sync="queryParams.pageSize"
        @pagination="getList"
      />
    </div>
  </template>
  
  <script>
  import {
    advWindowList,
    advWindowClerkDel
  } from "@/api/business/windowUser.js";
  import { userSelect, deptTreeSelect } from "@/api/system/user.js";
  export default {
    name: "project",
    dicts: ["sys_comp_fee_status", "sys_fee_type"],
  
    data() {
      return {
        // 选中数组
        ids: [],
        // 非单个禁用
        single: true,
        // 非多个禁用
        multiple: true,
        // 显示搜索条件
        dataList: [],
        // 遮罩层
        loading: true,
        // 显示搜索条件
        showSearch: true,
        // 总条数
        total: 0,
        // 查询参数
        queryParams: {
          pageNum: 1,
          pageSize: 10,
        },
        baseUrl: this.$VUE_APP_IMG_API,
      };
    },
    created() {
      this.getList();
    },
    methods: {
      // 多选框选中数据
      handleSelectionChange(selection) {
        this.ids = selection.map((item) => item.projectId);
        this.single = selection.length != 1;
        this.multiple = !selection.length;
      },
  
      /** 修改按钮操作 */
      handleUpdate(row) {
        const configId = row.projectId || this.ids;
        this.$router.push("./windowUserAdd?isEdit=true&id=" + row.advWindowClerkId);
      },
      handleDetail(row) {
        this.$router.push("./windowUserAdd?isInfo=true&id=" + row.advWindowClerkId);
      },
      /** 删除按钮操作 */
      handleDelete(row) {
        const configId = row.advWindowClerkId || this.ids;
        this.$modal
          .confirm('是否确认删除此条数据？')
          .then(function () {
            return advWindowClerkDel(configId);
          })
          .then(() => {
            this.getList();
            this.$modal.msgSuccess("删除成功");
          })
          .catch(() => {});
      },
      handleAdd() {
        this.$router.push("./windowUserAdd");
      },
      /** 查询列表 */
      getList() {
        this.loading = true;
        advWindowList(this.queryParams).then((response) => {
          this.dataList = response.rows;
          this.total = response.total;
          this.loading = false;
        });
      },
      /** 查询部门下拉树结构 */
      getDeptTree() {
        deptTreeSelect().then((response) => {
          this.deptOptions = response.data;
        });
      },
  
      /** 搜索按钮操作 */
      handleQuery() {
        this.queryParams.pageNum = 1;
        this.getList();
      },
      /** 重置按钮操作 */
      resetQuery() {
        this.resetForm("queryForm");
        this.handleQuery();
      },
    },
  };
  </script>
  <style lang="scss" scoped>
  ::v-deep .el-dialog__body {
    img {
      width: 100%;
    }
  }
  </style>
  